﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Template_Method
{
    public abstract class BasePay
    {
        public decimal Total { get; set; }
        public void Pay(string UserName,string Password)
        {
            if (CheckUser(UserName, Password))
            {
                this.Query();
                if (this.Paying())
                {
                    this.ComputeInteger();
                }
            }
        }
        protected bool CheckUser(string UserName,string Password)
        {
            //编写检测业务逻辑
            return true;
        }
        
        protected void Query()
        {
            Console.WriteLine("查询订单.....");
        }
        protected abstract bool Paying();
        protected virtual void ComputeInteger()
        {
            Console.WriteLine("获得会员积分{0}",this.Total);
        }
    }
}
